#define _CRT_SECURE_NO_WARNINGS  1
#include <iostream>
#include<vector>
#include<list>
using namespace std;

/*
int main()
{
    int n;
    cin >> n;
    while (n--)
    {
        int x, k;
        cin >> x >> k;

        vector<int> v1;
        vector<int> v2;
        vector<int> pre(2 * x);
        for (int i = 1; i <= 2 * x; i++)
        {
            cin >> pre[i - 1];
        }



        while (k--)
        {
            vector<int> ret;
            for (int i = 0; i < x; i++)
            {   
                ret.push_back(pre[i]);
                ret.push_back(pre[i+x]);
            }
           pre = ret;
        }

        for (auto ch : pre)
        {
            cout << ch << " ";
        }
        cout << endl;


    }
    return 0;
}

*/

int main()
{
    int n;
    cin >> n;
    string cmd;
    cin >> cmd;
    vector<int> v(n);
    int cur = 1;
    for (int i = 0; i < n; i++)
    {
        v[i] = i + 1; // 1 2 3 4 5 6 7 8 9 10
    }

    for (int i = 0; i < cmd.size(); i++)
    {
        if (cmd[i] == 'U')
        {
            cur--;
        }
        else if (cmd[i] == 'D')
        {
            cur++;
        }

        if (cur <= 0)
        {
            cur = n;
        }
        if (cur > 10)
        {
            cur = 1;
        }

    }

    if (n <= 4)
    {
        for (int i = 1; i <= 4; i++)
        {
            cout << i << ' ';
        }
        cout << endl;
        cout << cur;
    }

    else if (cmd[cmd.size() - 1] == 'D' && cur == 1)
    {
        for (int i = 0; i < 4; i++)
        {
            cout << i + cur << ' ';
        }
        cout << endl;
        cout << cur;
    }
    else if (cmd[cmd.size() - 1] == 'U' && cur == n)
    {
        for (int i = n - 3; i <= n; i++)
        {
            cout << i << ' ';
        }
        cout << endl;
        cout << cur;
    }
    else if (cmd[cmd.size() - 1] == 'U')
    {
        int tmp = cur;
        for (int i = 0; i < n; i++)
        {
            cout << tmp++ << ' ';
        }
        cout << endl;
        cout << cur;
    }
    else if (cmd[cmd.size() - 1] == 'D')
    {
        int tmp = cur - 3;
        for (int i = 0; i < n; i++)
        {
            cout << tmp++ << ' ';
        }
        cout << endl;
        cout << cur;
    }

    return 0;
}
